package cn.edu.java.internet;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class SocketServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(88);
        Socket socket = serverSocket.accept();

        InputStream inputStream = socket.getInputStream();

        byte[] bytes = new byte[1024];

        int num = inputStream.read(bytes);

        String str = new String(bytes, 0, num);

        System.out.println(socket + ":" + str);

        socket.close();
        serverSocket.close();
    }
}
